package cn.com.test;

import cn.com.domain.Student;
import cn.com.service.StudentService;
import cn.com.service.impl.StudentServiceImpl;
import cn.com.utils.jdbcutils;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;

public class fsf {
    public static void main(String[] args) throws SQLException {

        StudentService studentService=new StudentServiceImpl();
        Student beforestu=new Student(1001,"张三","男","计算机学院");
        Student nowstu=new Student(1004,"张三三","女","学院1");
        studentService.alterStudent(beforestu,nowstu);



//        List<Student> students = studentService.findAll();
//        for (Student student : students) {
//            System.out.println(student.getSid());
//            System.out.println(student.getStuname());
//            System.out.println(student.getSex());
//            System.out.println(student.getAcademy());
//            System.out.println("--------------");
//        }
//        Connection connection = jdbcutils.getConnection();
//        Statement statement = connection.createStatement();
//        String sql="select * from user";
//        ResultSet resultSet = statement.executeQuery(sql);
//        while (resultSet.next()){
//            //6.2 获取数据
//            String username = resultSet.getString("username");
//            String password = resultSet.getString("password");
//            System.out.println(username+"   "+password);
//        }
//        jdbcutils.close(resultSet,statement,connection);
    }
}
